package Element;

import java.lang.IllegalArgumentException;

import DistSys.SysConst;

/**
 * Thrown to indicate that the application has attempted to set a data, but\
 * that the data does not have the appropriate value.
 */
public class DataException extends IllegalArgumentException {
    /**
     * Constructs a <code>DataException</code> with a
     * specified categorie, data id and value.
     *
     * @param   cat    the categorie.
     * @param   id     the data id.
     * @param   value  the value.
     */
    //public DataException(int cat, int id, double value) {
    //    super("'" + value + "' is not valid for '" + SysConst.ssDataField[
    //        SysConst.mapData(new SysConst.MappedIndex(cat, id))] + "'.");
    //}
     public DataException(int index, double value) {
        super("'" + value + "' is not valid for '" +
              SysConst.getDataFieldFromValueIndex(index) + "'.");
    }

    /**
     * Constructs a <code>DataException</code> with a
     * specified field name and int value.
     *
     * @param   name   the field name.
     * @param   value  the int value.
     */
    public DataException(String name, int value) {
        super("'" + value + "' is not valid for '" + name + "'.");
    }


}
